package com.enlorenz.core.tag.base;

import java.io.IOException;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class CustomSimpleTagSupport extends SimpleTagSupport{
	
	protected void writeJSP(String jsp){
		JspWriter writer = getJspContext().getOut();
		try {
			writer.write(jsp);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
	
	protected void writeJSP(StringBuilder jsp){
		writeJSP(jsp.toString());
	}
	/**
	 * 获取PageContext域的属性
	 * @param key
	 * @return
	 */
	protected Object getPageContextAttr(String key){
		PageContext pageContext = (PageContext) getJspContext();
		return pageContext.findAttribute(key);
	}
	
}
